package ch7.ex12;

import static ch7.print.Print.*;

class Member{
	public Member(String id){
		println("Member constructor " + id);
	}
}

class Rodent{
	Member m = new Member("r1"),
		   p = new Member("r2");
	Rodent() {
		println("Rodent constructor");
	}
	public void hop(){
		println("Rodent hopping");
	}
	public void scurry(){
		println("Rodent scurring");
	}
	public void reproduce(){
		println("Making more Rodents");
	}
	public String toString(){
		return "Rodent";
	}
}

class Mouse extends Rodent{
	Member m = new Member("m1"),
	       p = new Member("m2");
	public Mouse() {
		println("Mouse constructor");
	}
	public void hop(){
		println("Mouse hopping");
	}
	public void scurry(){
		println("Mouse scurring");
	}
	public void reproduce(){
		println("Making more Mouses");
	}
	public String toString(){
		return "Mouse";
	}
}

class Gerbil extends Rodent{
	Member m = new Member("g1"),
    	   p = new Member("g2");
	public Gerbil() {
		println("Gerbil constructor");
	}
	public void hop(){
		println("Gerbil hopping");
	}
	public void scurry(){
		println("Gerbil scurring");
	}
	public void reproduce(){
		println("Making more Gerbils");
	}
	public String toString(){
		return "Gerbil";
	}
}

class Hamster extends Rodent{
	Member m = new Member("h1"),
    	   p = new Member("h2");
	public Hamster() {
		println("Hamster constructor");
	}
	public void hop(){
		println("Hamster hopping");
	}
	public void scurry(){
		println("Hamster scurring");
	}
	public void reproduce(){
		println("Making more Hamsters");
	}
	public String toString(){
		return "Hamster";
	}
} 
public class RodentInitialization {
	public static void main(String... args){
		new Hamster();
		println();
		new Gerbil();
		println();
		new Mouse();
	}
}
